﻿using System.Collections.Generic;

namespace MRGSP.SurveyMaster.Service.Utils
{
    public class LinkBuilder
    {
        private static readonly IDictionary<LinkType, string> Images = new Dictionary<LinkType, string>()
                                                                           {
                                                                               {LinkType.Add, "ui-icon ui-icon-circle-plus fl mt9"},
                                                                               {LinkType.Addcolumn, "ui-icon ui-icon-circle-arrow-e fl mt9"},
                                                                               {LinkType.Edit, "ui-icon ui-icon-circle-triangle-n fl mt9"},
                                                                               {LinkType.Remove, "ui-icon ui-icon-circle-minus fl mt9"},
                                                                           };
        public static string Build(LinkType type, string link, long id)
        {
            if (link.Contains("delete"))
                return string.Format(@"<a href='javascript:{0}({1})'>
                <span class='ui-state-error' style='border: 0 none'>
                <span class='{2}'/></span></span></a>", link, id, Images[type]);
            return string.Format("<a href='javascript:{0}({1})'><span class='{2}'/></span></a>", link, id, Images[type]);
        }

        public static string Build(LinkType type, string link, long id1, long id2)
        {
            return string.Format("<a href='javascript:{0}({1},{2})'><span class='{3}'/></span></a>", link, id1, id2, Images[type]);
        }
    }
}